// pages/recordList/recordList.js
import request from '../../utils/request.js';
Page({

  /**
   * 页面的初始数据
   */
  data: {
    List:[],
    rentBoxBindTotal:'',
    rentBoxTotal:'',
    useRate:'',
    systemUseRate:'',
    commission:'',
    orderTime:'',
    latelyTime:'',
    withdrawalRateCheck:'',
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad(options) {
    console.log(options);
    this.setData({
      roleId: wx.getStorageSync('roleId')
    })
    if (this.data.roleId == 1) {
      this.setData({
        withdrawalRateCheck: wx.getStorageSync('withdrawalRateCheck')
      })
    }
    if (this.data.roleId !== 0) {
      request({
        url: '/agent/device/count',
        method: 'GET',
      }).then(res => {
        if (res.data.code == 200) {
          this.setData({
            orderTotal: res.data.data.orderTotal,
            rentBoxBindTotal: res.data.data.rentBoxBindTotal,
            rentBoxTotal: res.data.data.rentBoxTotal,
            systemUseRate: res.data.data.systemUseRate,
            useRate: res.data.data.useRate,
            commission: Math.ceil((res.data.data.systemUseRate - res.data.data.useRate).toFixed(2)),
            withdrawalRateCheck: res.data.data.withdrawalRateCheck,
          })
        }
      })
      this.setData({
        totalIncome: options.totalIncome,
        uncheckMoney: options.uncheckMoney,
        withdrawalRate: options.withdrawalRate,
        phone: wx.getStorageSync('phone'),
        balance: options.balance,
        Withdrawable: (options.balance - options.uncheckMoney).toFixed(2)
      })
    } else {
      this.setData({
        phone: wx.getStorageSync('phone'),
      })
    }
  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady() {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow() {

  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide() {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload() {
	
  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh() {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom() {

  },

  /**
   * 用户点击右上角分享
   */
  
})